package com.beilang.base.exception;

import org.springframework.flex.core.ExceptionTranslator;

import flex.messaging.MessageException;
import com.beilang.base.property.AppDefaultProperty;

public class CheckExceptionTranslator implements ExceptionTranslator {
	public boolean handles(Class<?> clazz) {
		return true;
	}
	
	public MessageException translate(Throwable t) {
			MessageException ex = new MessageException();
			ex.setCode("Application Service");
			ex.setMessage(t.getLocalizedMessage());
			ex.setRootCause(t);
            if(!(t instanceof CheckException)){
                t.printStackTrace();
            }else{
                System.out.println(ex.getMessage());
            }
			return ex;
	}
}